<%
   new_prefix = sprintf("%s%s%s", prefix, prefix.empty? ? "" : "_", property.out_name)
   new_prefix = normal_method_name(new_prefix)
   func_def = sprintf("fill_%s(value):", new_prefix)
-%>
<% if property.is_a?(Api::Type::Array) && property.item_type.is_a?(Api::Type::NestedObject) -%>


def <%= func_def %>
    if not value:
        return None

    result = []
    for item in value:
        val = dict()
<%   nested_properties = nested_properties(property) -%>
<%   nested_properties.each do |prop| -%>

<%= fill_resp_parameter(prop, new_prefix, "val", "item", 8) %>
<%   end -%>

        result.append(val)

    return result
<%   nested_properties.each do |prop| -%>
<%= lines(build_fill_param_method(new_prefix, prop)) -%>
<%   end -%>
<% elsif property.is_a?(Api::Type::NestedObject) -%>


def <%= func_def %>
    if not value:
        return None

    result = dict()
<%   nested_properties = nested_properties(property) -%>
<%   nested_properties.each do |prop| -%>

<%= fill_resp_parameter(prop, new_prefix, "result", "value", 4) %>
<%   end -%>

    return result
<%   nested_properties.each do |prop| -%>
<%= lines(build_fill_param_method(new_prefix, prop)) -%>
<%   end -%>
<% end # if property.is_a?(Api::Type::Array) -%>
